package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Banner;
import cn.wolfcode.wolf2w.service.IBannerService;
import cn.wolfcode.wolf2w.service.IStrategyService;
import cn.wolfcode.wolf2w.util.JsonResult;
import com.alibaba.fastjson.JSON;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/index")
public class IndexController {
    @Autowired
    private IBannerService bannerService;
    @GetMapping("/banners/travel")
    public  Object bannersTravel(){
        Banner banner = new Banner();
        List<Banner> list =  bannerService.findByTop5(banner.getType());
        return JsonResult.success(list);
    }
    @GetMapping("/banners/strategy")
    public  Object bannersStrategy(){
        Banner banner = bannerService.findByTop1(Banner.TYPE_STRATEGY).get(0);
        return JsonResult.success(banner);
    }

}
